package com.artic.drools;

import org.drools.KnowledgeBase;
import org.drools.logger.KnowledgeRuntimeLogger;
import org.drools.logger.KnowledgeRuntimeLoggerFactory;
import org.drools.runtime.StatefulKnowledgeSession;

/**
 * Created by IntelliJ IDEA.
 * User: czarnik_a
 * Date: 27.01.11
 * Time: 09:55
 * To change this template use File | Settings | File Templates.
 */
public class MainDrools {

    public static void main(String[] args) {
        DroolsTest droolsTest = DroolsTest.getInstance();


        Applicant applicant = new Applicant();
        applicant.setName("Hugo");
        applicant.setAge(11);
        applicant.setValid(true);

        KnowledgeBase kbase = droolsTest.getKbase();
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
        KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "log");

        ksession.insert(applicant);

        ksession.fireAllRules();

        logger.close();
        ksession.dispose();

    }
}
